var limsMaterial = Gikam.getPageObject({

    getEditListColumns: function () {
        return [{
            checkbox: true
        }, {
            index: true
        }, {
            field: 'matCode',
            title: 'T_LIMS_MATERIAL.MATCODE',
            validators: ['notEmpty'],
            type: 'link'
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL.MATNAME',
            validators: ['notEmpty', 'strLength[0,40]'],
            // editor: true,
        }, {
            field: 'matTypeName',
            title: 'T_LIMS_MATERIAL.MATTYPENAME',
            validators: ['notEmpty']
        }, {
            field: 'brand',
            title: 'T_LIMS_MATERIAL.BRAND',
            // editor: true,
            validators: ['notEmpty', 'strLength[0,24]']
        }, {
            field: 'cargoNo',
            title: 'T_LIMS_MATERIAL.CARGONO',
            // editor: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'specifications',
            title: 'T_LIMS_MATERIAL.SPECIFICATIONS',
            // editor: true,
            validators: ['strLength[0,32]']
        }, {
            field: 'defaultUnitCode',
            title: 'T_LIMS_MATERIAL.DEFAULTUNITCODE',
            // editor: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'purchaseUnitCode',
            title: 'T_LIMS_MATERIAL.PURCHASEUNITCODE',
            // editor: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'storageUnitCode',
            title: 'T_LIMS_MATERIAL.STORAGEUNITCODE',
            // editor: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'matNum',
            title: 'T_LIMS_MATERIAL.MATNUM',
            // editor: true,
            validators: ['notEmpty', 'number']
        }, {
            field: 'minimum',
            title: 'T_LIMS_MATERIAL.MINIMUM',
            validators: ['notEmpty', 'number', 'numRange(0,)'],
            // editor: true,
        }, {
            field: 'storageLocation',
            title: 'T_LIMS_MATERIAL.STORAGELOCATION',
            // editor: true,
            validators: ['strLength[0,120]']
        }, {
            field: 'status',
            title: 'T_LIMS_MATERIAL.STATUS',
            editor: true,
            validators: ['notEmpty', 'strLength[0,20]'],
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'materialStatus'
            },
        },]
    },

    getBaseInfoFormFields: function () {
        return [{
            field: 'matCode',
            title: 'T_LIMS_MATERIAL.MATCODE',
            preInsert: true,
            validators: ['strLength[0,24]', 'notEmpty', 'remote[/secure/basemodule/rm/materials/action/validate-unique]']
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL.MATNAME',
            preInsert: true,
            validators: ['notEmpty', 'strLength[0,40]']
        }, {
            field: 'matTypeCode',
            title: 'T_LIMS_MATERIAL.MATTYPECODE',
            validators: ['notEmpty', 'strLength[0,24]'],
            preInsert: true,
            type: 'select',
            search: true,
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'materialType'
            },
            onChange: function (field, value, rowIndex, oldValue, text) {
                this.setData({
                    matTypeName: text,
                    matTypeCode: value
                })
            }
        }, {
            field: 'matTypeName',
            title: 'T_LIMS_MATERIAL.MATTYPENAME',
            validators: ['strLength[0,16]'],
        }, {
            field: 'brand',
            title: 'T_LIMS_MATERIAL.BRAND',
            preInsert: true,
            validators: ['notEmpty', 'strLength[0,24]']
        }, {
            field: 'matNum',
            title: 'T_LIMS_MATERIAL.MATNUM',
            // preInsert: true,
            validators: ['notEmpty', 'number']
        }, {
            field: 'cargoNo',
            title: 'T_LIMS_MATERIAL.CARGONO',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'specifications',
            title: 'T_LIMS_MATERIAL.SPECIFICATIONS',
            preInsert: true,
            validators: ['strLength[0,32]']
        }, {
            field: 'defaultUnitCode',
            title: 'T_LIMS_MATERIAL.DEFAULTUNITCODE',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'purchaseUnitCode',
            title: 'T_LIMS_MATERIAL.PURCHASEUNITCODE',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'storageUnitCode',
            title: 'T_LIMS_MATERIAL.STORAGEUNITCODE',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'minimum',
            title: 'T_LIMS_MATERIAL.MINIMUM',
            preInsert: true,
            validators: ['notEmpty', 'number', 'numRange(0,)']
        }, {
            field: 'storageLocation',
            title: 'T_LIMS_MATERIAL.STORAGELOCATION',
            preInsert: true,
            validators: ['strLength[0,53]']
        }, {
            field: 'status',
            title: 'T_LIMS_MATERIAL.STATUS',
            validators: ['notEmpty', 'strLength[0,8]'],
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'materialStatus'
            },
        },]
    },

    getEditInfoFormFields: function () {
        return [{
            field: 'matCode',
            title: 'T_LIMS_MATERIAL.MATCODE',
            preInsert: true,
            validators: ['strLength[0,24]', 'notEmpty', 'remote[/secure/basemodule/rm/materials/action/validate-unique]']
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL.MATNAME',
            preInsert: true,
            validators: ['notEmpty', 'strLength[0,40]']
        }, {
            field: 'matTypeCode',
            title: 'T_LIMS_MATERIAL.MATTYPECODE',
            validators: ['notEmpty', 'strLength[0,24]'],
            preInsert: true,
            type: 'select',
            search: true,
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'materialType'
            },
            onChange: function (field, value, rowIndex, oldValue, text) {
                this.setData({
                    matTypeName: text,
                    matTypeCode: value
                })
            }
        }, {
            field: 'brand',
            title: 'T_LIMS_MATERIAL.BRAND',
            preInsert: true,
            validators: ['notEmpty', 'strLength[0,24]']
        }, {
            field: 'cargoNo',
            title: 'T_LIMS_MATERIAL.CARGONO',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'specifications',
            title: 'T_LIMS_MATERIAL.SPECIFICATIONS',
            preInsert: true,
            validators: ['strLength[0,32]']
        }, {
            field: 'defaultUnitCode',
            title: 'T_LIMS_MATERIAL.DEFAULTUNITCODE',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'purchaseUnitCode',
            title: 'T_LIMS_MATERIAL.PURCHASEUNITCODE',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'storageUnitCode',
            title: 'T_LIMS_MATERIAL.STORAGEUNITCODE',
            preInsert: true,
            validators: ['strLength[0,10]']
        }, {
            field: 'minimum',
            title: 'T_LIMS_MATERIAL.MINIMUM',
            preInsert: true,
            validators: ['notEmpty', 'number', 'numRange(0,)']
        }, {
            field: 'storageLocation',
            title: 'T_LIMS_MATERIAL.STORAGELOCATION',
            preInsert: true,
            validators: ['strLength[0,53]']
        }, ]
    },

    getShowListColumns: function () {
        return [{
            checkbox: true
        }, {
            index: true
        }, {
            field: 'matCode',
            title: 'T_LIMS_MATERIAL.MATCODE'
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL.MATNAME',
            validators: ['notEmpty', 'strLength[0,40]'],
        }, {
            field: 'matTypeName',
            title: 'T_LIMS_MATERIAL.MATTYPENAME'
        }, {
            field: 'brand',
            title: 'T_LIMS_MATERIAL.BRAND',
        }, {
            field: 'cargoNo',
            title: 'T_LIMS_MATERIAL.CARGONO',
        }, {
            field: 'specifications',
            title: 'T_LIMS_MATERIAL.SPECIFICATIONS',
        }, {
            field: 'defaultUnitCode',
            title: 'T_LIMS_MATERIAL.DEFAULTUNITCODE',
        }, {
            field: 'purchaseUnitCode',
            title: 'T_LIMS_MATERIAL.PURCHASEUNITCODE',
        }, {
            field: 'storageUnitCode',
            title: 'T_LIMS_MATERIAL.STORAGEUNITCODE',
        }, {
            field: 'matNum',
            title: 'T_LIMS_MATERIAL.MATNUM',
        }, {
            field: 'minimum',
            title: 'T_LIMS_MATERIAL.MINIMUM',
        }, {
            field: 'storageLocation',
            title: 'T_LIMS_MATERIAL.STORAGELOCATION',
        }, {
            field: 'status',
            title: 'T_LIMS_MATERIAL.STATUS',
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'materialStatus'
            },
        },]
    },

    getChooseListColumns: function () {
        return [{index: true},{
            field: 'matCode',
            title: 'T_LIMS_MATERIAL.MATCODE'
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL.MATNAME'
        }, {
            field: 'matTypeCode',
            title: 'T_LIMS_MATERIAL.MATTYPECODE'
        }, {
            field: 'matTypeName',
            title: 'T_LIMS_MATERIAL.MATTYPENAME'
        }, {
            field: 'brand',
            title: 'T_LIMS_MATERIAL.BRAND'
        }, {
            field: 'cargoNo',
            title: 'T_LIMS_MATERIAL.CARGONO'
        }, {
            field: 'specifications',
            title: 'T_LIMS_MATERIAL.SPECIFICATIONS'
        }, {
            field: 'defaultUnitCode',
            title: 'T_LIMS_MATERIAL.DEFAULTUNITCODE'
        }, {
            field: 'purchaseUnitCode',
            title: 'T_LIMS_MATERIAL.PURCHASEUNITCODE'
        }, {
            field: 'storageUnitCode',
            title: 'T_LIMS_MATERIAL.STORAGEUNITCODE'
        }, {
            field: 'matNum',
            title: 'T_LIMS_MATERIAL.MATNUM',
        }, {
            field: 'minimum',
            title: 'T_LIMS_MATERIAL.MINIMUM'
        }, {
            field: 'storageLocation',
            title: 'T_LIMS_MATERIAL.STORAGELOCATION'
        }, {
            field: 'status',
            title: 'T_LIMS_MATERIAL.STATUS',
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'materialStatus'
            },
        },]
    },

    baseUrl: IFM_CONTEXT + '/secure/basemodule/rm/materials',

    /**
     * 材料库存
     */
    getStandardInventoryEditListColumns: function () {
        return [{
            checkbox: true
        }, {
            index: true
        }, {
            field: 'storageBatch',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGEBATCH',
            validators: ['strLength[0,24]'],
            preInsert: true,
        }, {
            field: 'storageNo',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGENO',
            validators: ['notEmpty', 'strLength[0,24]'],
            preInsert: true,
        }, {
            field: 'ext$.matexpired',
            title: 'T_LIMS_STANDARD_INVENTORY.EXPIRED',
            type: 'select',
            category: 'sys',
            param: {
                codeCategoryId: 'yesorno'
            },
            styleFormatter: function (row) {
                if (row.ext$.matexpired === '1') {
                    return {color: '#FF2D2D'}
                }
            }
        }, {
            field: 'supplier',
            title: 'T_LIMS_STANDARD_INVENTORY.SUPPLIER',
            validators: ['notEmpty', 'strLength[0,36]'],
            preInsert: true,
        }, {
            field: 'operateTime',
            title: 'T_LIMS_STANDARD_INVENTORY.OPERATETIME',
            validators: ['notEmpty'],
            type: 'dateTime',
            editor: true,
            width: 140
        }, {
            field: 'buyer',
            title: 'T_LIMS_STANDARD_INVENTORY.BUYER',
            validators: ['strLength[0,36]'],
            editor: true,
        }, {
            field: 'storehouseManager',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSEMANAGER',
            validators: ['strLength[0,36]'],
            editor: true,
        }, {
            field: 'storageNum',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGENUM',
            validators: ['notEmpty', 'number'],
            onChange: function (field, value, index, oldValue, text) {
                this.setData({
                    batchNum: value
                })
            },
            preInsert: true,
        }, {
            field: 'batchNum',
            title: 'T_LIMS_STANDARD_INVENTORY.BATCHNUM',
            validators: ['number'],
            //preInsert : true,
        }, {
            field: 'warrantyExpiryDate',
            title: 'T_LIMS_STANDARD_INVENTORY.WARRANTYEXPIRYDATE',
            type: 'dateTime',
            editor: true,
            validators: ['notEmpty'],
            width: 140
        }, {
            field: 'usefulTime',
            title: 'T_LIMS_STANDARD_INVENTORY.USEFULTIME',
            editor: true,
            type: 'dateTime',
            validators: ['notEmpty'],
            width: 140
        }, {
            field: 'productionDate',
            title: 'T_LIMS_STANDARD_INVENTORY.PRODUCTIONDATE',
            type: 'dateTime',
            width: 140
        }, {
            field: 'storehouse',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSE',
            validators: ['strLength[0,120]'],
            editor: true,
        }, {
            field: 'storehouseLocation',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSELOCATION',
            validators: ['strLength[0,120]'],
            editor: true,
        }, {
            field: 'remark',
            title: 'T_LIMS_STANDARD_INVENTORY.REMARK',
            validators: ['strLength[0,150]'],
            preInsert: true,
            editor: true,
        }]
    },

    getStandardInventoryBaseInfoFormFields: function () {
        return [{
            checkbox: true
        }, {index: true},{
            field: 'storageNo',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGENO',
            validators: ['notEmpty', 'strLength[0,24]'],
            preInsert: true,
        }, {
            field: 'supplier',
            title: 'T_LIMS_STANDARD_INVENTORY.SUPPLIER',
            validators: ['notEmpty', 'strLength[0,36]'],
            preInsert: true,
        }, {
            field: 'operateTime',
            title: 'T_LIMS_STANDARD_INVENTORY.OPERATETIME',
            validators: ['notEmpty'],
            type: 'dateTime',
            preInsert: true,
        }, {
            field: 'buyer',
            title: 'T_LIMS_STANDARD_INVENTORY.BUYER',
            validators: ['strLength[0,36]'],
            preInsert: true,
        }, {
            field: 'storehouseManager',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSEMANAGER',
            validators: ['strLength[0,36]'],
            preInsert: true,
        }, {
            field: 'storageNum',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGENUM',
            validators: ['notEmpty', 'number'],
            onChange: function (field, value, index, oldValue, text) {
                this.setData({
                    batchNum: value
                })
            },
            preInsert: true,
        }, /*{
            field: 'batchNum',
            title: 'T_LIMS_STANDARD_INVENTORY.BATCHNUM',
            validators: ['number'],
            //preInsert : true,
        },*/ /*{
            field: 'storageBatch',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGEBATCH',
            validators: ['strLength[0,24]'],
            // preInsert: true,
        },*/ {
            field: 'warrantyExpiryDate',
            title: 'T_LIMS_STANDARD_INVENTORY.WARRANTYEXPIRYDATE',
            type: 'dateTime',
            validators: ['notEmpty'],
            preInsert: true,
        }, {
            field: 'usefulTime',
            title: 'T_LIMS_STANDARD_INVENTORY.USEFULTIME',
            preInsert: true,
            validators: ['notEmpty'],
            type: 'dateTime',
        }, {
            field: 'productionDate',
            title: 'T_LIMS_STANDARD_INVENTORY.PRODUCTIONDATE',
            preInsert: true,
            type: 'dateTime',
        }, {
            field: 'storehouse',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSE',
            validators: ['strLength[0,120]'],
            preInsert: true,
        }, {
            field: 'storehouseLocation',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSELOCATION',
            validators: ['strLength[0,120]'],
            preInsert: true,
        }, {
            field: 'remark',
            title: 'T_LIMS_STANDARD_INVENTORY.REMARK',
            validators: ['strLength[0,150]'],
            preInsert: true,
        }];
    },

    getStandardInventoryOutFields: function (preInsert) {
        return [{
            field: 'issueType',
            title: 'T_LIMS_STANDARD_HISTORY.ISSUETYPE',
            preInsert: preInsert,
            type: 'select',
            firstBlank: false,
            validators: ['notEmpty'],
            category: 'sys',
            param: {
                codeCategoryId: 'materialOutType'
            },
        }, {
            field: 'outNum',
            title: 'T_LIMS_STANDARD_INVENTORY.OUTNUM',
            preInsert: true,
            validators: ['notEmpty', 'integer', 'numRange(0,)'],
        }];
    },

    getInventoryFormFields: function () {
        return [{
            field: 'difference',
            title: 'T_LIMS_STANDARD_INVENTORY.DIFFERENCE',
            preInsert: true,
            type: 'select',
            category: 'sys',
            param: {
                codeCategoryId: 'operation'
            },
            firstBlank: false,
            validators: ['notEmpty']
        }, {
            field: 'differenceNum',
            title: 'T_LIMS_STANDARD_INVENTORY.DIFFERENCENUM',
            preInsert: true,
            validators: ['notEmpty', 'integer', 'numRange(0,)']
        }, {
            field: 'remark',
            title: 'T_LIMS_MATERIAL_APPLY.REMARK',
            preInsert: true
        }];
    },

    /**
     * 材料库存历史记录
     */
    getStandardHistoryEditListColumns: function () {
        return [{
            checkbox: true
        }, {
            index: true
        }, {
            field: 'auditStatus',
            title: 'T_LIMS_STANDARD_HISTORY.AUDITSTATUS',
            width: 90
        }, {
            field: 'operation',
            title: 'T_LIMS_STANDARD_HISTORY.OPERATION',
            width: 110
        }, {
            field: 'issueType',
            title: 'T_LIMS_STANDARD_HISTORY.ISSUETYPE',
            type: 'select',
            firstBlank: false,
            validators: ['notEmpty'],
            category: 'sys',
            param: {
                codeCategoryId: 'materialOutType'
            },
            width: 90
        }, {
            field: 'quantity',
            title: 'T_LIMS_STANDARD_HISTORY.QUANTITY',
            readonly: true,
            width: 60
        }, {
            field: 'createdByName',
            title: 'T_LIMS_STANDARD_HISTORY.CREATEDBYNAME',
            readonly: true,
            width: 110
        }, {
            field: 'createdTime',
            title: 'T_LIMS_STANDARD_HISTORY.CREATEDTIME',
            readonly: true,
            width: 140
        }, {
            field: 'completeTime',
            title: 'T_LIMS_STANDARD_HISTORY.COMPLETETIME',
            type: 'dateTime',
            width: 140
        }, {
            field: 'createdByOrgName',
            title: 'T_LIMS_STANDARD_HISTORY.CREATEDBYORGNAME',
            readonly: true,
            width: 250
        }]
    },
})
